<template>
    <div class="subscribe">
        <div class="subscribe-nav">
            <select-module
                label="选择城市："
                :options="cities"
                :keyName="`code`"
                :contentName="`cityname`"
                v-model="cityCodes"
            ></select-module>

            <select-module
                label="所属行业："
                :options="majorList"
                :keyName="`diccode`"
                :contentName="`dicname`"
                v-model="majorIds"
            ></select-module>

            <select-multiplet-module
                label="公告类型："
                v-model="noticeIds"
                :options="noticeList"
            ></select-multiplet-module>

            <div class="other">
                <div class="key-word">
                    <div class="title">关键词设置：</div>
                    <el-input v-model="keyWord" size="mini" placeholder="请输入3-5个关键词﹐每个关键词最多10个字﹐用空格隔开"></el-input>
                </div>
                <div class="matching">
                    <div class="title">匹配设置：</div>
                    <el-radio-group v-model="radio">
                        <el-radio :label="0">包含任一关键词</el-radio>
                        <el-radio :label="1">包含所有关键词</el-radio>
                    </el-radio-group>
                </div>
            </div>
        </div>

        <el-divider></el-divider>

        <div class="subscribe-content">
            <template v-if="itemList && itemList.length > 0">
                <div class="items" v-for="(item , ind) in itemList" :key="item.docname">
                    <content-item
                    :data="item"
                    :title="`${ind+1}.${item.docname}`"
                    :time="item.collecttime"
                    :tagList="item.taglist"
                    :tagName="'tagname'"
                    :tagType="'type'"
                    :rowguid="item.guid"
                    @titleClick="titleClick"
                    >
                        <template slot="content">
                            
                        </template>
                    </content-item>
                </div>
            </template>

            <empty-list v-if="!itemList.length">
                <span>暂无数据</span>
            </empty-list>
        </div>
    </div>
</template>

<script>
import selectModule from "../../components/select-module.vue";
import selectMultipletModule from "../../components/select-multiple-module.vue";
import contentItem from "../../components/item.vue";

import EmptyList from "@components/sys/empty-list";

import { mapGetters, mapActions } from "vuex";
export default {
    components: {
        selectModule,
        selectMultipletModule,
        contentItem,
        EmptyList,
    },
    data() {
        return {
            cityCodes: [],
            noticeList: [],
            noticeIds: [],
            majorList: [],
            majorIds: [],
            itemList: [
                {
                    addtime: "2022-06-21 09:40:51",
                    collecttime: 1656489894000,
                    coverrowguid: "0e02e6fdbcc74a06b134976d881fd32e",
                    docname: "苗木供应投标方案",
                    doctypecode: "tbfa",
                    doctypename: "行业标准",
                    downloadamount: 4,
                    guid: "C97D90524E6B488ABDFCB62604730332",
                    onhomepageactive: false,
                    noticetext:"石家庄市错那县肖一带DB边贸物资交流中心建设项目中标公告",
                    noticelink:"https://fanyi.baidu.com/#en/zh/",
                    taglist: [
                        {
                            addtime: 1655779594000,
                            adduserid: "1",
                            addusername: "admin",
                            documentguid: "C97D90524E6B488ABDFCB62604730332",
                            parentcode: "major",
                            tagid: "nlmy",
                            type: "normal",
                            tagname: "农林牧渔",
                        },
                        {
                            addtime: 1655779594000,
                            adduserid: "1",
                            addusername: "admin",
                            documentguid: "C97D90524E6B488ABDFCB62604730332",
                            parentcode: "doctype",
                            tagid: "hybz",
                            type: "normal",
                            tagname: "行业标准",
                        },
                        {
                            addtime: 1655779594000,
                            adduserid: "1",
                            addusername: "admin",
                            documentguid: "C97D90524E6B488ABDFCB62604730332",
                            parentcode: "doctype",
                            tagid: "money",
                            type: "money",
                            tagname: "893.00元",
                        },
                    ],
                    viewamount: 49,
                },
                {
                    addtime: "2022-06-21 09:41:20",
                    collecttime: 1656489880000,
                    coverrowguid: "167dffc4b06c4958a22beeb644b82a59",
                    docname: "玉米播种技术投标方案",
                    doctypecode: "tbfa",
                    doctypename: "投标文件",
                    downloadamount: 5,
                    guid: "1AC25786D4F447FFB9D4D7DABB2CCD5B",
                    onhomepageactive: false,
                    noticetext:"石家庄市错那县肖一带DB边贸物资交流中心建设项目中标公告",
                    noticelink:"https://fanyi.baidu.com/#en/zh/",
                    taglist: [
                        {
                            addtime: 1655779581000,
                            adduserid: "1",
                            addusername: "admin",
                            documentguid: "1AC25786D4F447FFB9D4D7DABB2CCD5B",
                            parentcode: "doctype",
                            tagid: "tenderfile",
                            tagname: "投标文件",
                        },
                        {
                            addtime: 1655779581000,
                            adduserid: "1",
                            addusername: "admin",
                            documentguid: "1AC25786D4F447FFB9D4D7DABB2CCD5B",
                            parentcode: "major",
                            tagid: "nlmy",
                            tagname: "农林牧渔",
                        },
                    ],
                    viewamount: 72,
                },
            ],
            keyWord:"",
            radio:1,
        };
    },
    computed: {
        ...mapGetters({
            cities: "city/getCities",
        }),
    },
    methods: {
        ...mapActions({
            queryCity: 'city/queryCities',
        }),
        int() {
            setTimeout(() => {
                this.getNoticeData();
            }, 1000);
            this.getMajorData();
        },
        getNoticeData() {
            this.noticeList = [
                {
                    label: "拟建项目",
                    id: "1",
                    children: [],
                },
                {
                    label: "采购意向",
                    id: "2",
                    children: [],
                },
                {
                    label: "招标预告",
                    id: "3",
                    children: [],
                },
                {
                    label: "招标公告",
                    id: "4",
                    children: [
                        {
                            label: "招标",
                            id: "401",
                        },
                        {
                            label: "邀标",
                            id: "402",
                        },
                        {
                            label: "询价",
                            id: "403",
                        },
                        {
                            label: "竞谈",
                            id: "404",
                        },
                        {
                            label: "单一",
                            id: "405",
                        },
                        {
                            label: "竞价",
                            id: "406",
                        },
                        {
                            label: "变更",
                            id: "407",
                        },
                    ],
                },
                {
                    label: "招标结果",
                    id: "5",
                    children: [
                        {
                            label: "中标",
                            id: "501",
                        },
                        {
                            label: "成标",
                            id: "502",
                        },
                        {
                            label: "废标",
                            id: "503",
                        },
                        {
                            label: "流标",
                            id: "504",
                        },
                    ],
                },
                {
                    label: "招标信用信息",
                    id: "6",
                    children: [
                        {
                            label: "合同",
                            id: "601",
                        },
                        {
                            label: "验收",
                            id: "602",
                        },
                        {
                            label: "违规",
                            id: "603",
                        },
                    ],
                },
            ];
        },
        getMajorData() {
            this.$get(
                `${this.$store.state.api.tbUrl}/document/gettreetype.json`,
                {
                    toptype: "tbfa",
                },
                (data, res) => {
                    this.majorList = data[1].children;
                }
            );
        },
        titleClick(data){
            console.log(data);
        }
    },
    mounted() {
        this.int();
        this.queryCity();
    },
};
</script>

<style lang="scss" scoped>
@import "@css/var.scss";
.subscribe {
    .subscribe-nav {
        .other {
            display: flex;
            justify-content: space-between;
            align-items:baseline;
            margin-top: 5px;
            width: 800px;

            div {
                display: flex;
                justify-content: space-between;
                align-items:baseline;

                .title {
                    font-weight: 600;
                }
            }

            .key-word {
                width: 440px;
                .title {
                    width: 120px;
                }
            }
        }
    }

    .subscribe-content {
        .items {
            margin-top: 15px;
        }
    }
}
</style>